<template>
  <div class="newList">
    <div class="newList-title">
      <span class="newList-title-p1 reset">
        <span class="line" /> 鑫椤会议
      </span>
    </div>
    <ul class="meet-box">
      <li class="meet-li" v-for="(i,index) in list" @click="newsDetail(i)" :key="index">
        <div class="img">
          <div class="meet-stauts" :class="'meet-stauts'+i.status">{{i.statusText}}</div>
          <img v-if="!i.imgurl" src="./meetnull.png" alt />
          <img v-else :src="i.imgurl" alt />
        </div>
        <div class="meet-text">
          <p class="meet-text-p">
            <van-icon class="icon1" :name="icon1" />
            {{i.begin_date_str}}~{{i.end_date_str}}
          </p>
          <p class="meet-text-p">
            <van-icon class="icon1" :name="icon2" />
            {{i.address}}
          </p>
          <div class="btn-router">查看详情</div>
        </div>
      </li>
    </ul>
  </div>
</template>

<script type="text/ecmascript-6">
import dings from "../../assets/img/icon-ding.png";
import icon1 from "../../assets/img/meeting/iconri.png";
import icon2 from "../../assets/img/meeting/icondz.png";
import { formatstr } from "../../assets/js/tools";
export default {
  props: ["meetList"],
  data() {
    return {
      icon1,
      icon2
    };
  },
  computed: {
    list() {
      var nowtime = new Date().getTime();
      for (let index = 0; index < this.meetList.length; index++) {
        const element = this.meetList[index];
        element.begin_date_str = formatstr(element.begin_date);
        element.end_date_str = formatstr(element.end_date);
        var starttrap = new Date(element.begin_date).getTime();
        var endTime = new Date(element.end_date).getTime();
        if (nowtime > endTime) {
          element.status = 2; //过期
          element.statusText = "已结束";
        } else if (nowtime < endTime && nowtime > starttrap) {
          element.status = 0; //进行中
          element.statusText = "进行中";
        } else if (nowtime < starttrap) {
          element.status = 1; //未开始
          element.statusText = "未开始";
        }
      }
      return this.meetList;
    }
  },
  created() {},
  methods: {
    newsDetail(i) {
      console.log("hee", i);
      this.$router.push({ path: "meetDetails", query: i });
    }
  }
};
</script>

<style scoped lang="less">
.newList {
  background: #ffffff;
  margin-bottom: 0.2rem;
}
.newList-title {
  padding: 0 0.3rem;
  height: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .line {
    display: block;
    width: 0.08rem;
    height: 0.32rem;
    background: rgba(228, 157, 53, 1);
    border-radius: 5px;
    margin-right: 0.2rem;
  }
  .newList-title-p1 {
    display: flex;
    align-items: center;
    font-size: 0.36rem;
    font-weight: bold;
    color: rgba(21, 23, 35, 1);
  }
}
.meet-box {
  padding: 0 0.3rem 0.3rem;
  .meet-li {
    padding: 0 0 0.3rem;
    margin-bottom: 0.3rem;
    border-bottom: 0.02rem solid rgba(229, 229, 229, 1);
    .img {
      margin-bottom: 0.3rem;
      position: relative;
      width: 6.9rem;
      height: 2.16rem;
      text-align: center;
      img {
        height: 100%;
      }
    }
    .meet-stauts {
      position: absolute;
      top: 0;
      left: 0;
      width: 1.4rem;
      height: 0.5rem;
      line-height: 0.5rem;
      text-align: center;
      background: linear-gradient(
        270deg,
        rgba(238, 89, 79, 0) 0%,
        rgba(216, 45, 39, 1) 100%
      );
      font-size: 0.24rem;
      color: rgba(255, 255, 255, 1);
      opacity: 0.8;
      border-radius: 0.04rem;
      &.meet-stauts1 {
        background: linear-gradient(
          270deg,
          rgba(228, 152, 41, 0) 0%,
          #042fff 100%
        );
      }
      &.meet-stauts2 {
        background: linear-gradient(
          270deg,
          rgba(228, 152, 41, 0) 0%,
          rgba(228, 152, 41, 1) 100%
        );
      }
    }
    .meet-text {
      position: relative;
    }
    .meet-text-p {
      padding-right: 2rem;
      height: 0.34rem;
      font-size: 0.24rem;
      line-height: 0.34rem;
      color: rgba(39, 41, 55, 1);
      display: flex;
      align-items: center;
      margin-bottom: 0.1rem;
    }
    .icon1 {
      font-size: 0.28rem;
      margin-right: 0.1rem;
    }
  }
  .btn-router {
    width: 1.8rem;
    height: 0.7rem;
    line-height: 0.66rem;
    background: #fcf4e9;
    border: 0.02rem solid #e49829;
    border-radius: 0.08rem;
    color: #e49829;
    text-align: center;
    position: absolute;
    right: 0;
    top: 0.04rem;
  }
}
</style>
